package com.sina.weibo;

import android.app.Dialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.Display;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RadioButton;
import android.widget.Toast;
import com.sina.weibo.models.Account;
import com.sina.weibo.models.MBlog;
import com.sina.weibo.models.User;
import com.sina.weibo.models.UserInfo;
import com.sina.weibo.view.MBlogListItemView;
import com.sina.weibo.view.MainListItemView;
import com.sina.weibo.view.UserInfoListItemView;
import java.io.File;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;

public class SearchActivity extends HomeListBaseActivity
  implements View.OnClickListener
{
  public static final int DO_SEARCH = 0;
  public static final String KEY_SEARCH_FLAG = "searchflag";
  public static final String KEY_SEARCH_WORDS = "searchwords";
  public static final String SEARCHKEYWORDLISTPATH = "/searchkeywordlistcache";
  private static final int SEARCH_MBLOG = 1;
  private static final int SEARCH_USER;
  Handler handler;
  private String keyword = null;
  public ArrayAdapter<String> keywordAdapter;
  HashSet<String> keywords;
  List<String> kwsList;
  private AutoCompleteTextView mActvKeyword;
  private Button mBtSearch;
  private int mExpandItem = 0;
  private List<String> mHistoryList;
  private ListView mLvSearch;
  private int mPage = 1;
  private CustomToast mPgCustomToast;
  private Dialog mPgDialog;
  private Toast mPgToast;
  private RadioButton mRbSearchUser;
  private RadioButton mRbSearchWeibo;
  private int mReadMode;
  private LinearLayout mSearchBox;
  int mSearchMode = 0;
  private HashSet<String> mSearchWords;
  private FetchDataTask mTask;
  private boolean mTaskFree = 1;
  private int mTotal = 0;
  int preSearchMode = 0;
  private String query = null;
  private int searchFlag = -1;

  public SearchActivity()
  {
    SearchActivity.1 local1 = new SearchActivity.1(this);
    this.handler = local1;
  }

  private void closeProgress(List<?> paramList, String paramString)
  {
    if ((paramList != null) && (paramList.size() > 0))
      switch (this.mSearchMode)
      {
      default:
        if (this.mList.size() > 0)
        {
          ((WeiboListAdapter)this.mLvSearch.getAdapter()).refresh();
          if (this.mExpandItem != 0)
          {
            ListView localListView1 = this.mLvSearch;
            int i = this.mExpandItem;
            localListView1.setSelection(i);
          }
          this.mLvSearch.setVisibility(0);
          this.mLvSearch.setFocusable(1);
          this.mLvSearch.setFocusableInTouchMode(1);
          label115: if ((this.mList != null) && (this.mList.size() != 0))
            break label812;
          this.mLvSearch.setVisibility(4);
          if ((paramList == null) || (StaticInfo.mUser == null))
            break;
          switch (this.mSearchMode)
          {
          default:
          case 0:
          case 1:
          }
        }
      case 1:
      case 0:
      }
    while (true)
    {
      return;
      if (this.mList == null)
        this.mList = paramList;
      Iterator localIterator1;
      Iterator localIterator2;
      while ((this.mList != null) && (this.mList.size() != 0))
      {
        List localList1 = this.mList;
        MBlog[] arrayOfMBlog1 = new MBlog[0];
        MBlog[] arrayOfMBlog2 = (MBlog[])localList1.toArray(arrayOfMBlog1);
        SearchActivity.9 local9 = new SearchActivity.9(this);
        Arrays.sort(arrayOfMBlog2, local9);
        ArrayList localArrayList1 = new ArrayList();
        this.mList = localArrayList1;
        int j = 0;
        while (true)
        {
          int k = arrayOfMBlog2.length;
          if (j >= k)
            break;
          List localList2 = this.mList;
          MBlog localMBlog1 = arrayOfMBlog2[j];
          boolean bool1 = localList2.add(localMBlog1);
          j += 1;
        }
        if (paramList.size() > 0)
        {
          localIterator1 = paramList.iterator();
          while (true)
          {
            if (!localIterator1.hasNext())
            {
              List localList3 = this.mList;
              MBlog[] arrayOfMBlog3 = new MBlog[0];
              arrayOfMBlog2 = (MBlog[])localList3.toArray(arrayOfMBlog3);
              SearchActivity.8 local8 = new SearchActivity.8(this);
              Arrays.sort(arrayOfMBlog2, local8);
              ArrayList localArrayList2 = new ArrayList();
              this.mList = localArrayList2;
              j = 0;
              while (true)
              {
                int m = arrayOfMBlog2.length;
                if (j >= m)
                  break;
                List localList4 = this.mList;
                MBlog localMBlog2 = arrayOfMBlog2[j];
                boolean bool2 = localList4.add(localMBlog2);
                j += 1;
              }
            }
            MBlog localMBlog3 = (MBlog)localIterator1.next();
            localIterator2 = this.mList.iterator();
            String str1;
            String str2;
            do
            {
              if (!localIterator2.hasNext())
              {
                boolean bool3 = this.mList.add(localMBlog3);
                break;
              }
              MBlog localMBlog4 = (MBlog)localIterator2.next();
              str1 = localMBlog3.mblogid;
              str2 = localMBlog4.mblogid;
            }
            while (!str1.equals(str2));
          }
        }
        int n = this.mPage - 1;
        this.mPage = n;
      }
      if (this.mList == null)
      {
        this.mList = paramList;
        break;
      }
      if (paramList.size() > 0)
      {
        localIterator1 = paramList.iterator();
        while (localIterator1.hasNext())
        {
          UserInfo localUserInfo1 = (UserInfo)localIterator1.next();
          localIterator2 = this.mList.iterator();
          String str3;
          String str4;
          do
          {
            if (!localIterator2.hasNext())
            {
              boolean bool4 = this.mList.add(localUserInfo1);
              break;
            }
            UserInfo localUserInfo2 = (UserInfo)localIterator2.next();
            str3 = localUserInfo1.uid;
            str4 = localUserInfo2.uid;
          }
          while (!str3.equals(str4));
        }
      }
      int i1 = this.mPage - 1;
      this.mPage = i1;
      break;
      this.mLvSearch.setVisibility(4);
      break label115;
      if (StaticInfo.mUser != null)
      {
        if (paramList != null)
          break label115;
        String str5 = getString(2131427391);
        Toast.makeText(this, str5, 0).show();
        break label115;
      }
      String str6 = getString(2131427402);
      Toast.makeText(this, str6, 0).show();
      break label115;
      String str7 = getString(2131427394);
      Toast.makeText(this, str7, 0).show();
      continue;
      String str8 = getString(2131427395);
      Toast.makeText(this, str8, 0).show();
      continue;
      label812: ((WeiboListAdapter)this.mLvSearch.getAdapter()).refresh();
      this.mLvSearch.setVisibility(0);
      this.mLvSearch.setFocusable(1);
      ListView localListView2 = this.mLvSearch;
      int i2 = this.mExpandItem;
      localListView2.setSelection(i2);
      this.mLvSearch.setFocusableInTouchMode(1);
    }
  }

  private void doSearch(String paramString, int paramInt)
  {
    if ((this.mTask != null) && (!this.mTask.isCancelled()))
      boolean bool1 = this.mTask.cancel(1);
    Message localMessage = new Message();
    localMessage.what = 0;
    Bundle localBundle = new Bundle();
    localBundle.putString("searchwords", paramString);
    localBundle.putInt("searchflag", paramInt);
    localMessage.setData(localBundle);
    boolean bool2 = this.handler.sendMessage(localMessage);
  }

  private void reloadSearchList()
  {
    reloadBegine(0);
    Intent localIntent = new Intent("sina.weibo.action.UPDATED");
    sendBroadcast(localIntent);
    if (this.mTaskFree)
    {
      this.mPage = 1;
      String str = String.valueOf(this.mPage);
      FetchDataTask localFetchDataTask1 = new FetchDataTask(null);
      this.mTask = localFetchDataTask1;
      FetchDataTask localFetchDataTask2 = this.mTask;
      String[] arrayOfString = new String[1];
      arrayOfString[0] = str;
      AsyncTask localAsyncTask = localFetchDataTask2.execute(arrayOfString);
    }
  }

  private void search(String paramString, int paramInt)
  {
    this.query = paramString;
    this.mList = null;
    this.mSearchMode = paramInt;
    if (this.query != null)
    {
      int i = this.mSearchMode;
      this.preSearchMode = i;
      this.mPage = 1;
      FetchDataTask localFetchDataTask1 = new FetchDataTask(null);
      this.mTask = localFetchDataTask1;
      String str1 = String.valueOf(1);
      FetchDataTask localFetchDataTask2 = this.mTask;
      String[] arrayOfString = new String[1];
      arrayOfString[0] = str1;
      AsyncTask localAsyncTask = localFetchDataTask2.execute(arrayOfString);
      boolean bool1 = this.keywords.add(paramString);
      this.kwsList.clear();
      List localList = this.kwsList;
      HashSet localHashSet1 = this.keywords;
      boolean bool2 = localList.addAll(localHashSet1);
      String str2 = String.valueOf(getCacheDir().getAbsolutePath());
      String str3 = str2 + "/searchkeywordlistcache";
      HashSet localHashSet2 = this.keywords;
      Utils.saveUsrnameList(str3, localHashSet2);
      String str4 = String.valueOf(getCacheDir().getAbsolutePath());
      HashSet localHashSet3 = (HashSet)Utils.loadUsrnameList(str4 + "/searchkeywordlistcache");
      this.keywords = localHashSet3;
      if (this.keywords != null)
        break label296;
    }
    label296: for (HashSet localHashSet4 = new HashSet(); ; localHashSet4 = this.keywords)
    {
      this.keywords = localHashSet4;
      AutoCompleteTextView localAutoCompleteTextView = this.mActvKeyword;
      HashSet localHashSet5 = this.keywords;
      ArrayList localArrayList = new ArrayList(localHashSet5);
      this.kwsList = localArrayList;
      ArrayAdapter localArrayAdapter = new ArrayAdapter(this, 17367050, localArrayList);
      this.keywordAdapter = localArrayAdapter;
      localAutoCompleteTextView.setAdapter(localArrayAdapter);
      return;
    }
  }

  public boolean dispatchKeyEvent(KeyEvent paramKeyEvent)
  {
    boolean bool;
    if (paramKeyEvent.getKeyCode() != 84)
      bool = super.dispatchKeyEvent(paramKeyEvent);
    while (true)
    {
      return bool;
      if (super.dispatchKeyEvent(paramKeyEvent))
      {
        bool = false;
        continue;
      }
      bool = true;
    }
  }

  protected void handleTitleBarEvent(int paramInt)
  {
    switch (paramInt)
    {
    default:
    case 1:
    }
    while (true)
    {
      return;
      Intent localIntent1 = new Intent();
      Intent localIntent2 = localIntent1.setClass(this, MainTabActivity.class);
      startActivity(localIntent1);
      finish();
    }
  }

  public void onClick(View paramView)
  {
    Button localButton = this.mBtSearch;
    if (paramView == localButton)
    {
      String str1 = this.keyword;
      this.query = str1;
      this.mList = null;
      int i = this.searchFlag;
      this.mSearchMode = i;
      if (this.query != null)
      {
        int j = this.mSearchMode;
        this.preSearchMode = j;
        this.mPage = 1;
        FetchDataTask localFetchDataTask1 = new FetchDataTask(null);
        this.mTask = localFetchDataTask1;
        String str2 = String.valueOf(1);
        FetchDataTask localFetchDataTask2 = this.mTask;
        String[] arrayOfString = new String[1];
        arrayOfString[0] = str2;
        AsyncTask localAsyncTask = localFetchDataTask2.execute(arrayOfString);
      }
    }
    super.onClick(paramView);
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    String str1 = getString(2131427528);
    String str2 = getString(2131427358);
    setTitleBar(1, str1, str2, null);
    WeiboListAdapter localWeiboListAdapter = new WeiboListAdapter();
    ListView localListView1 = this.mlvBase;
    this.mLvSearch = localListView1;
    LinearLayout localLinearLayout = (LinearLayout)findViewById(2131624032);
    this.mSearchBox = localLinearLayout;
    this.mSearchBox.setVisibility(0);
    AutoCompleteTextView localAutoCompleteTextView1 = (AutoCompleteTextView)findViewById(2131624033);
    this.mActvKeyword = localAutoCompleteTextView1;
    String str3 = String.valueOf(getCacheDir().getAbsolutePath());
    HashSet localHashSet1 = (HashSet)Utils.loadUsrnameList(str3 + "/searchkeywordlistcache");
    this.keywords = localHashSet1;
    Object localObject;
    String str4;
    if (this.keywords == null)
    {
      localObject = new HashSet();
      this.keywords = ((HashSet)localObject);
      AutoCompleteTextView localAutoCompleteTextView2 = this.mActvKeyword;
      HashSet localHashSet2 = this.keywords;
      ArrayList localArrayList1 = new ArrayList(localHashSet2);
      this.kwsList = localArrayList1;
      ArrayAdapter localArrayAdapter = new ArrayAdapter(this, 17367050, localArrayList1);
      this.keywordAdapter = localArrayAdapter;
      localAutoCompleteTextView2.setAdapter(localArrayAdapter);
      Button localButton1 = (Button)findViewById(2131624034);
      this.mBtSearch = localButton1;
      Button localButton2 = this.mBtSearch;
      SearchActivity.2 local2 = new SearchActivity.2(this);
      localButton2.setOnClickListener(local2);
      this.mLvSearch.setAdapter(localWeiboListAdapter);
      this.mLvSearch.setLongClickable(1);
      ListView localListView2 = this.mLvSearch;
      SearchActivity.3 local3 = new SearchActivity.3(this);
      localListView2.setOnItemLongClickListener(local3);
      ListView localListView3 = this.mLvSearch;
      SearchActivity.4 local4 = new SearchActivity.4(this);
      localListView3.setOnItemClickListener(local4);
      ListView localListView4 = this.mLvSearch;
      SearchActivity.5 local5 = new SearchActivity.5(this);
      localListView4.setOnScrollListener(local5);
      this.mList = null;
      localObject = getString(2131427358);
      if (StaticInfo.mUser != null)
        break label698;
      str4 = null;
      label368: setAppTitle((String)localObject, str4);
      ArrayList localArrayList2 = new ArrayList();
      String str5 = getString(2131427416);
      boolean bool1 = localArrayList2.add(str5);
      String str6 = getString(2131427417);
      boolean bool2 = localArrayList2.add(str6);
      String str7 = getString(2131427418);
      boolean bool3 = localArrayList2.add(str7);
      Display localDisplay = ((WindowManager)getSystemService("window")).getDefaultDisplay();
      int i = localDisplay.getWidth();
      int j = localDisplay.getHeight();
      int k = getIntent().getIntExtra("searchFlag", 1);
      this.searchFlag = k;
      String str8 = getIntent().getStringExtra("keyword");
      this.keyword = str8;
      AutoCompleteTextView localAutoCompleteTextView3 = this.mActvKeyword;
      String str9 = URLDecoder.decode(this.keyword);
      localAutoCompleteTextView3.setText(str9);
      String str10 = String.valueOf(this.searchFlag);
      StringBuilder localStringBuilder = new StringBuilder(str10).append("_________");
      String str11 = this.keyword;
      String str12 = str11;
      int m = Log.d("$$$$$$$$$", str12);
      RadioButton localRadioButton1 = (RadioButton)findViewById(2131624037);
      this.mRbSearchUser = localRadioButton1;
      RadioButton localRadioButton2 = this.mRbSearchUser;
      SearchActivity.6 local6 = new SearchActivity.6(this);
      localRadioButton2.setOnCheckedChangeListener(local6);
      RadioButton localRadioButton3 = (RadioButton)findViewById(2131624036);
      this.mRbSearchWeibo = localRadioButton3;
      RadioButton localRadioButton4 = this.mRbSearchWeibo;
      SearchActivity.7 local7 = new SearchActivity.7(this);
      localRadioButton4.setOnCheckedChangeListener(local7);
      if (this.searchFlag != 1)
        break label709;
      this.mRbSearchWeibo.setChecked(1);
    }
    while (true)
    {
      return;
      localObject = this.keywords;
      break;
      label698: str4 = StaticInfo.mUser.nick;
      break label368;
      label709: this.mRbSearchUser.setChecked(1);
    }
  }

  public boolean onCreateOptionsMenu(Menu paramMenu)
  {
    return false;
  }

  public boolean onOptionsItemSelected(MenuItem paramMenuItem)
  {
    return false;
  }

  protected void onPause()
  {
    if ((!this.mTaskFree) && (this.mTask != null) && (!this.mTask.isCancelled()))
    {
      this.mTaskFree = 1;
      boolean bool = this.mTask.cancel(1);
      if (this.mPgToast != null)
        this.mPgToast.cancel();
    }
    super.onPause();
  }

  protected void onResume()
  {
    int i = getSharedPreferences("readmode", 0).getInt("readmode", 0);
    if (this.mReadMode != i)
    {
      this.mReadMode = i;
      this.keywordAdapter.notifyDataSetChanged();
    }
    if (this.mList != null)
    {
      ((WeiboListAdapter)this.mLvSearch.getAdapter()).refresh();
      this.mLvSearch.setVisibility(0);
      this.mLvSearch.setFocusable(1);
      this.mLvSearch.setFocusableInTouchMode(1);
    }
    super.onResume();
  }

  protected void reloadList()
  {
    this.mBeReload = 1;
    reloadSearchList();
    this.mExpandItem = 1;
  }

  class FetchDataTask extends AsyncTask<String, Integer, List<?>>
  {
    String error;

    private FetchDataTask()
    {
    }

    protected List<?> doInBackground(String[] paramArrayOfString)
    {
      int i = Integer.parseInt(paramArrayOfString[0]);
      Object[] arrayOfObject = (Object[])0;
      SearchActivity localSearchActivity2;
      try
      {
        int j;
        if ((!StaticInfo.mUsername.equals("")) && (!StaticInfo.mPassword.equals("")))
        {
          if (StaticInfo.mUser == null)
          {
            RPCHelper localRPCHelper1 = RPCHelper.getInstance(SearchActivity.this.getApplication());
            String str1 = StaticInfo.mUsername;
            String str2 = StaticInfo.mPassword;
            StaticInfo.mUser = localRPCHelper1.login(str1, str2);
            if ((StaticInfo.mUser.gsid == null) || (StaticInfo.mUser.uid == null))
            {
              StaticInfo.mUser = null;
              Object localObject1 = null;
              return localObject1;
            }
            List localList = AccountHelper.loadAccounts(SearchActivity.this);
            Account localAccount = new Account();
            String str3 = StaticInfo.mUsername;
            localAccount.user = str3;
            String str4 = StaticInfo.mPassword;
            localAccount.pass = str4;
            String str5 = StaticInfo.mUser.nick;
            localAccount.nick = str5;
            AccountHelper.addOrSortAccount(localList, localAccount);
            AccountHelper.saveAccounts(SearchActivity.this, localList);
            User localUser1 = StaticInfo.mUser;
            String str6 = SearchActivity.this.mCacheDir;
            SearchActivity localSearchActivity1 = SearchActivity.this;
            Utils.saveUserFile(localUser1, str6, localSearchActivity1);
          }
          j = SearchActivity.this.mSearchMode;
        }
        switch (j)
        {
        default:
        case 1:
          while (true)
          {
            this = (List)arrayOfObject[1];
            FetchDataTask localFetchDataTask = this;
            break;
            RPCHelper localRPCHelper2 = RPCHelper.getInstance(SearchActivity.this.getApplication());
            User localUser2 = StaticInfo.mUser;
            String str7 = SearchActivity.this.query;
            int n = MainTabActivity.mPrefPictureSize;
            arrayOfObject = localRPCHelper2.searchMBlog(localUser2, str7, n, i, 25);
            localSearchActivity2 = SearchActivity.this;
            if (arrayOfObject[0] == 0)
              break label364;
            int k = ((Integer)arrayOfObject[0]).intValue();
            localSearchActivity2.mTotal = k;
          }
        case 0:
        }
      }
      catch (RPCHelper.HttpException localHttpException)
      {
        while (true)
        {
          SearchActivity localSearchActivity3 = SearchActivity.this;
          Throwable localThrowable = Utils.getRootCause(localHttpException);
          String str8 = Utils.translationThrowable(localSearchActivity3, localThrowable);
          this.error = str8;
          Object localObject2 = null;
          continue;
          label364: m = 0;
        }
        RPCHelper localRPCHelper3 = RPCHelper.getInstance(SearchActivity.this.getApplication());
        User localUser3 = StaticInfo.mUser;
        String str9 = SearchActivity.this.query;
        arrayOfObject = localRPCHelper3.searchUser(localUser3, str9, i, 25);
        localSearchActivity2 = SearchActivity.this;
        if (arrayOfObject[0] == 0);
      }
      for (int m = ((Integer)arrayOfObject[0]).intValue(); ; m = 0)
      {
        localSearchActivity2.mTotal = m;
        break;
      }
    }

    protected void onCancelled()
    {
      SearchActivity.this.setProgressBarIndeterminateVisibility(0);
      if ((SearchActivity.this.mList == null) || (SearchActivity.this.mList.size() == 0))
      {
        SearchActivity.this.mLvSearch.setVisibility(4);
        switch (SearchActivity.this.mSearchMode)
        {
        default:
        case 1:
        case 0:
        }
      }
      while (true)
      {
        SearchActivity.this.reloadEnd(0);
        SearchActivity.this.mTaskFree = 1;
        SearchActivity.this.mPgCustomToast.cancel();
        return;
        SearchActivity localSearchActivity1 = SearchActivity.this;
        String str1 = SearchActivity.this.getString(2131427386);
        Toast.makeText(localSearchActivity1, str1, 0).show();
        continue;
        SearchActivity localSearchActivity2 = SearchActivity.this;
        String str2 = SearchActivity.this.getString(2131427391);
        Toast.makeText(localSearchActivity2, str2, 0).show();
        continue;
        ((SearchActivity.WeiboListAdapter)SearchActivity.this.mLvSearch.getAdapter()).refresh();
        SearchActivity.this.mLvSearch.setVisibility(0);
        SearchActivity.this.mLvSearch.setFocusable(1);
        SearchActivity.this.mLvSearch.setFocusableInTouchMode(1);
      }
    }

    protected void onPostExecute(List<?> paramList)
    {
      SearchActivity.this.mTaskFree = 1;
      SearchActivity.this.setProgressBarIndeterminateVisibility(0);
      SearchActivity.this.reloadEnd(0);
      SearchActivity localSearchActivity = SearchActivity.this;
      String str = this.error;
      localSearchActivity.closeProgress(paramList, str);
      SearchActivity.this.mPgCustomToast.cancel();
    }

    protected void onPreExecute()
    {
      SearchActivity.this.mTaskFree = 0;
      SearchActivity.this.setProgressBarIndeterminateVisibility(1);
      if ((SearchActivity.this.mList == null) || (SearchActivity.this.mList.size() == 0))
      {
        if (SearchActivity.this.mPgToast == null)
        {
          SearchActivity localSearchActivity1 = SearchActivity.this;
          SearchActivity localSearchActivity2 = SearchActivity.this;
          CustomToast localCustomToast = Utils.createProgressCustomToast(2131427419, localSearchActivity2);
          localSearchActivity1.mPgCustomToast = localCustomToast;
        }
        SearchActivity.this.mPgCustomToast.show();
      }
    }

    protected void onProgressUpdate(Integer[] paramArrayOfInteger)
    {
    }
  }

  class WeiboListAdapter extends BaseAdapter
  {
    public WeiboListAdapter()
    {
    }

    public int getCount()
    {
      if (SearchActivity.this.mList == null);
      for (int i = 0; ; i = SearchActivity.this.mList.size() + 1)
        return i;
    }

    public Object getItem(int paramInt)
    {
      return Integer.valueOf(paramInt);
    }

    public long getItemId(int paramInt)
    {
      return paramInt;
    }

    public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
    {
      Object localObject1 = null;
      Object localObject2;
      if (SearchActivity.this.mList == null)
      {
        localObject2 = null;
        return localObject2;
      }
      int i = SearchActivity.this.mList.size();
      int j = paramInt;
      int k = i;
      if (j == k)
      {
        localObject1 = SearchActivity.this.getLoadMoreView();
        int m = SearchActivity.this.mList.size();
        int n = SearchActivity.this.mTotal;
        if (m < n)
          ((View)localObject1).setVisibility(0);
      }
      while (true)
      {
        localObject2 = localObject1;
        break;
        ((View)localObject1).setVisibility(4);
        continue;
        int i1 = 1;
        int i2 = 0;
        switch (SearchActivity.this.mSearchMode)
        {
        default:
          break;
        case 0:
          if (paramView == null)
          {
            SearchActivity localSearchActivity1 = SearchActivity.this;
            ListView localListView1 = SearchActivity.this.mLvSearch;
            List localList1 = SearchActivity.this.mList;
            int i3 = paramInt;
            UserInfo localUserInfo1 = (UserInfo)localList1.get(i3);
            int i4 = SearchActivity.this.mReadMode;
            localObject1 = new UserInfoListItemView(localSearchActivity1, localListView1, localUserInfo1, i2, i4);
            continue;
          }
          localObject1 = paramView;
          try
          {
            UserInfoListItemView localUserInfoListItemView = (UserInfoListItemView)localObject1;
            List localList2 = SearchActivity.this.mList;
            int i5 = paramInt;
            Object localObject3 = localList2.get(i5);
            int i6 = SearchActivity.this.mReadMode;
            localUserInfoListItemView.update(localObject3, i2, i6);
          }
          catch (Exception localException1)
          {
            SearchActivity localSearchActivity2 = SearchActivity.this;
            ListView localListView2 = SearchActivity.this.mLvSearch;
            List localList3 = SearchActivity.this.mList;
            int i7 = paramInt;
            UserInfo localUserInfo2 = (UserInfo)localList3.get(i7);
            int i8 = SearchActivity.this.mReadMode;
            localObject1 = new UserInfoListItemView(localSearchActivity2, localListView2, localUserInfo2, i2, i8);
          }
          break;
        case 1:
          if (paramView == null)
          {
            localObject1 = new com/sina/weibo/view/MBlogListItemView;
            SearchActivity localSearchActivity3 = SearchActivity.this;
            ListView localListView3 = SearchActivity.this.mLvSearch;
            List localList4 = SearchActivity.this.mList;
            int i9 = paramInt;
            MBlog localMBlog1 = (MBlog)localList4.get(i9);
            int i10 = SearchActivity.this.mReadMode;
            Object localObject4 = localObject1;
            int i11 = i2;
            localObject4.<init>(localSearchActivity3, localListView3, localMBlog1, i1, i11, 0, 0, i10);
            continue;
          }
          localObject1 = paramView;
          try
          {
            MainListItemView localMainListItemView = (MainListItemView)localObject1;
            List localList5 = SearchActivity.this.mList;
            int i12 = paramInt;
            Object localObject5 = localList5.get(i12);
            int i13 = SearchActivity.this.mReadMode;
            int i14 = i2;
            localMainListItemView.update(localObject5, i1, i14, 0, i13);
          }
          catch (Exception localException2)
          {
            localObject1 = new com/sina/weibo/view/MBlogListItemView;
            SearchActivity localSearchActivity4 = SearchActivity.this;
            ListView localListView4 = SearchActivity.this.mLvSearch;
            List localList6 = SearchActivity.this.mList;
            int i15 = paramInt;
            MBlog localMBlog2 = (MBlog)localList6.get(i15);
            int i16 = SearchActivity.this.mReadMode;
            Object localObject6 = localObject1;
            int i17 = i2;
            localObject6.<init>(localSearchActivity4, localListView4, localMBlog2, i1, i17, 0, 0, i16);
          }
        }
      }
    }

    public int getViewTypeCount()
    {
      int i;
      if (SearchActivity.this.mList == null)
        i = 1;
      while (true)
      {
        return i;
        int j = SearchActivity.this.mList.size();
        int k = SearchActivity.this.mTotal;
        if (j < k)
        {
          i = 4;
          continue;
        }
        i = 3;
      }
    }

    public void refresh()
    {
      notifyDataSetChanged();
    }
  }
}